﻿using System.Data.Entity.ModelConfiguration;
using BeautyTech.Core.Domain.Catalogs;

namespace BeautyTech.Data.Configuration.Catalog
{
    public class ProductConfiguration : EntityTypeConfiguration<Product>
    {
        public ProductConfiguration()
        {
            this.Property(p => p.Reference).HasMaxLength(15).IsRequired();

            this.Property(p => p.Name).HasMaxLength(64).IsRequired();
            this.Property(p => p.DisplayName).HasMaxLength(128).IsRequired();
            this.Property(p => p.Brand).HasMaxLength(35);
            this.Property(p => p.Supplier).HasMaxLength(35);

            this.Property(p => p.Price).HasPrecision(10, 2);
            this.Property(p => p.Weight).HasPrecision(10, 2);

            this.Property(p => p.DisplayOrder).IsOptional();

            this.Property(p => p.CreatedOn).HasColumnType("date");
            this.Property(p => p.UpdatedOn).HasColumnType("date");

        }
    }
}
